﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms.DataVisualization.Charting;

namespace MuseUI
{
    public static class Extensions
    {
        public static Series Clone(this Series series, bool withPoints = false)
        {
            var output = new Series(series.Name) { ChartType = series.ChartType, Color = series.Color, ChartArea = series.ChartArea };
            if (withPoints)
            {
                for (int i = 0; i < series.Points.Count; i++)
                {
                    output.Points.AddXY(series.Points[i].XValue, series.Points[i].YValues[0]);
                }
            }

            return output;
        }
    }
}
